package com.shanxia.codec.enums;

import java.util.Objects;

public enum BatteryTypeEnum {

    QIANSUAN(0x01, "铅酸电池"),
    NIEQING(0x02, "镍氢电池"),
    LINSUANTIELI(0x03, "磷酸铁锂电池"),
    MENGSUANLI(0x04, "锰酸锂电池"),
    GUSUANLI(0x05, "钴酸锂电池"),
    SANYUANCILIAO(0x06, "三元次料电池"),
    JUHEWULILIZI(0x07, "聚合物锂离子电池"),
    TAISUANLI(0x08, "钛酸锂电池"),
    OTHER(0xFF, "其他电池"),
    UNKNOWN(99, "未知");

    public static BatteryTypeEnum getByCode(int code) {
        for (BatteryTypeEnum enums : BatteryTypeEnum.values()) {
            if (Objects.equals(enums.code, code)) {
                return enums;
            }
        }
        return BatteryTypeEnum.UNKNOWN;
    }

    BatteryTypeEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public int code;
    public String name;
}